Skip to content

Proof of concept: (visually) simplify issue counter, add progress bar#1192

Closed
simonpcouch wants to merge 2 commits into
mainfrom
multi-progress
Closed

Proof of concept: (visually) simplify issue counter, add progress bar#1192
simonpcouch wants to merge 2 commits into
mainfrom
multi-progress

Conversation

@simonpcouch

Copy link
Copy Markdown
Contributor

Just a proof-of-concept: largely vibe-coded and not intended to be merged. The necessary cli version is not even on CRAN yet, and this code just assumes it's there.

tune's current progress infrastructure assumes that we're only able to update one progress bar at a time, and anything else cat()ted out must be fixed. We will soon be able to update several at a time. This means that 1) tune could undo the "mapping" thing where we have labels A, B, C, etc, and then actually track the count of those labels in a different line, and 2) tune could, alongside the existing "there are issues" progress functionality, introduce a genuine progress bar at the top. This is what this looks like:

pb.mov

This is with:

# pak::pak("r-lib/cli")
library(cli)
devtools::load_all()
options(cli.ansi = TRUE, cli.progress_show_after = 0)

raise_mixed <- function(x) {
  r <- runif(1)
  if (r < 0.4) {
    warning("Column 'Lot_Area' has non-finite values that may affect model fitting")
  } else if (r < 0.7) {
    stop("RBF kernel requires at least one non-negative bandwidth parameter")
  } else if (r < 0.85) {
    warning("prediction from rank-deficient fit; consider predict(., rankdeficient=\"NA\")")
  }
  x
}

set.seed(123)
res <- tune::tune_grid(
  parsnip::nearest_neighbor("regression", "kknn", dist_power = tune()),
  Sale_Price ~ .,
  rsample::vfold_cv(modeldata::ames[, c(72, 30:45)], 10),
  grid = 5,
  control = tune::control_grid(extract = raise_mixed)
)

@simonpcouch simonpcouch closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant